package edu.wtbu.cs.bishe.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 注册增加：手机验证、邮箱验证、图片验证码
 * @author Administrator
 * @date 2025-3-16
 *
 */
@RestController
@RequestMapping("/api")
public class RegisterController {

    @PostMapping("/register")
    public ResponseEntity<?> registerUser(@RequestBody Map<String, String> userData) {
        String username = userData.get("username");
        String email = userData.get("email");
        String password = userData.get("password");
        System.out.println("username: " + username);
        System.out.println("email: " + email);

        // 在这里处理注册逻辑，例如保存到数据库
        // 如果成功，返回 success: true
        // 如果失败，返回 success: false 和错误信息

        Map<String, Object> response = new HashMap<>();
        response.put("success", true);
        response.put("message", "注册成功");
        return ResponseEntity.ok(response);
    }
}